<?php 

class CategoryController extends CommonController{
	public $model;
	
	public function __init(){
		parent::__init();
	    $this->model = K('Category');
	}
	public function index(){
		$cid = Q('get.cid',0,'intval');
		$data = $this->model->where("pid={$cid}")->all();
		foreach ($data as $k => $v) {
			$sonpid = $v['cid'];
			$data[$k]['son'] = $this->model->where("pid={$sonpid}")->all();
		}
		$this->head();
		$this->assign("data",$data);
	    $this->dis('category');
	}
}
